loadstring(exports.dgs:dgsImportFunction())()

local allowed = { { 48, 57 }, { 65, 90 }, { 97, 122 } }

function generateString ( len )
    
    if tonumber ( len ) then
        math.randomseed ( getTickCount () )

        local str = ""
        for i = 1, len do
            local charlist = allowed[math.random ( 1, 3 )]
            str = str .. string.char ( math.random ( charlist[1], charlist[2] ) )
        end

        return str
    end
    return false
end

cmtaANTYBOT = false
local sw,sh = guiGetScreenSize()
local px,py = sw/1366,sh/768
font2 = dgsCreateFont( ":cmta-pobieraniezasobow/OSB.ttf", 11*px )
font = dgsCreateFont( ":cmta-pobieraniezasobow/OSB.ttf", 18*px )

function antybot()
cmtaANTYBOT = true
dgsSetInputMode ( "no_binds_when_editing" )
kod = generateString ( 10 )
window = dgsCreateWindow(400*px,200*py,566*px,368*py,"",false,false,false,false,tocolor(210,105,30),false,false,false,true)
edit = dgsCreateEdit( 150*px, 150*py, 266*px, 30*py, "", false,window)
button = dgsCreateButton( 180*px, 240*py, 206*px, 40*py, "Potwierdź", false,window,false,false,false,false,false,false,false,tocolor(90,90,90),tocolor(255,0,0,90))
text = dgsCreateLabel(0*px,60*py,566*px,50*py,"#808080Twój kod do przepisania to: #ccc000"..kod.."\n#ff0000wielkość liter ma znaczenie\n#808080masz na to 60 sekund!",false,window)
dgsSetFont( text, font2 )
dgsBringToFront(window)
dgsSetProperty(text,"colorcoded",true)
dgsSetProperty(text,"alignment",{"center","center"})
text2 = dgsCreateLabel(0*px,5*py,566*px,50*py,"#FF0000Anty Bot",false,window)
dgsSetFont( text2, font )
dgsSetProperty(text2,"colorcoded",true)
dgsSetProperty(text2,"alignment",{"center","center"})
showCursor(true)
timer = setTimer(function()
triggerServerEvent("cmta_antybot",resourceRoot)
end, 60000, 1)
addEventHandler ( "onDgsMouseClick", getRootElement(), onclick)
end

function onclick ( btn, state )
    if btn == "left" and state == "down" and cmtaANTYBOT == true then
        if source == button then
        local wpisanykod = dgsGetText(edit)
        if kod == wpisanykod then
            cmtaANTYBOT = false
            kod = nil
            showCursor(false)
            destroyElement(window)
            dgsSetInputMode ( "allow_binds" )
            if isTimer(timer) then killTimer(timer) end
            removeEventHandler ( "onDgsMouseClick", getRootElement(), onclick)
        end
        end
    end
end